home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / ast_comp / sql.txt / dsl.l < prev    next >
Encoding:
Text File  |  1993-07-04  |  1.8 KB  |  90 lines

  1. /*
  2. Distributed data base Facilitator
  3. Parser
  4. Version 1.0
  5. Copyright 1986 Columbia Union College
  6. By Leroy G. Cain
  7. */
  8. %{
  9. #include "string.h"
  10. #include "parser.h"
  11. #include "rwsearch.c"
  12. %}
  13. D       [0-9]
  14. E       [Ee][-+]?{D}+
  15. %%
  16. [a-zA-Z]+   
  17. {
  18. int     rw;
  19.  
  20.         if((rw= rwsearch(yytext)) == IDENTIFIER )
  21.         {
  22.                 yylval.nsbuf = strcpy(scratch,yytext);
  23.         }
  24.                 return rw;
  25. }
  26.  
  27. "$"[a-zA-Z_][a-zA-Z0-9_#@]* return( PARM );
  28.  
  29. [a-zA-Z_][a-zA-Z0-9_#@]* {   
  30.     yylval.nsbuf = strcpy (scratch, yytext);   /* KMW */
  31.     return IDENTIFIER ;
  32. }
  33.  
  34. \"[^\"]*        |
  35. \'[^\']*        
  36. {
  37.         if(yytext[yyleng-1] ==  '\\')
  38.                 yymore();
  39.         else
  40.         {
  41.                 yytext[yyleng++] = input();
  42.                 yytext[yyleng] = '\0';
  43.                 return( STRING );
  44.         }
  45. }
  46.  
  47. {D}+    return ( INTEGER );
  48.  
  49. {D}+"."{D}*({E})?       |
  50. {D}+"."{D}+({E})?       |
  51. {D}+{E} return ( REAL );
  52.  
  53. ":"     return ':' ;
  54. ";"     return ';' ;
  55. ".*"    return ALLFIELDS ;
  56. "."     return '.' ;
  57. ","     return ',' ;
  58. "!"     return NOT ;
  59. "!="    return NE ;
  60. "<="    return LE ;
  61. ">="    return GE ;
  62. "<"     return LT ;
  63. "!<"    return NLT ;
  64. ">"     return GT ;
  65. "!>"    return NGT ;
  66. "("     return '(' ;
  67. ")"     return ')' ;
  68. ">>"    return RIGHTSHIFT ;
  69. "<<"    return LEFTSHIFT ;
  70. "|"     return '|' ; /* Bit or */
  71. "||"    return E_OR ; /* or */
  72. "^"     return '^' ; /* Bit ex-or */
  73. "&"     return '&' ; /* Bit and */
  74. "&&"    return E_AND ; /* and */
  75. "~"     return '~' ; /* Ones compliment */
  76. "`"     return '`' ; /* Sematic control */
  77. "]"     return ']' ;
  78. "["     return '[' ;
  79. "="     return EQ ;
  80. "+"     return '+' ;
  81. "-"     return '-' ;
  82. "*"     return '*' ;
  83. "**"    return PWR ;
  84. "/"     return '/' ;
  85. "%"     return '%' ; /* Modulus */
  86. "?"     return '?' ;
  87. [/] return( ILLEGAL );
  88. [ \n\t\r] ;
  89. %%
  90.